<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<style type="text/css">
			*{
				margin: 0;
				padding: 0;
			}
			html,
			body {
				width: 100%;
				height: 100%;
				display: flex;
				/* 规定子元素水平居中(视觉垂直居中) */
				justify-content: center;
			}
			.divMovies{
				flex-wrap: 1;
				display: flex;
				/* 设置排列方向 */
				flex-direction: column;
				/* 规定子元素垂直居中(视觉水平居中) */
				align-items: center;
				width: 50%;
			}
			.data .poster img{
				width: 150px;
				height: 150px;
			}
		</style>
	</head>
	<body>
		<div id="divMovies" class="divMovies">
			
		</div>
		<script type="text/javascript">
			var datas = [
				{"poster":"img/1.jpg","time":new Date()},
				{"poster":"img/2.jpg","time":new Date()},
				{"poster":"img/3.jpg","time":new Date()},
				{"poster":"img/4.jpg","time":new Date()},
				{"poster":"img/5.jpg","time":new Date()},
				{"poster":"img/1.jpg","time":new Date()},
				{"poster":"img/2.jpg","time":new Date()},
				{"poster":"img/3.jpg","time":new Date()},
				{"poster":"img/4.jpg","time":new Date()},
				{"poster":"img/5.jpg","time":new Date()}
			];

			function setMovieHtml(movies) {
				var html = '';
				var id=1
				for (var i = 0; i < movies.length; i++) {
					var m = movies[i];
					m.id=i;
					html +=
						`<div class="data">
								<div class="poster">
									<img src="${m.poster}" alt="">
								</div>
								<div class="words">
								<div class="desc">
									id:${m.id}
								</div>
									<div class="desc">
										${m.time}
									</div>
								</div>
						</div>`;
				}
				document.getElementById('divMovies').innerHTML = html;
			}
			setMovieHtml(datas);
		</script>
	</body>
</html>
